<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
	var str = 'abcdef';

	//用test来对括号内的str进行测试是否符合规则
	var re1 = new RegExp('d');
	// alert(re1.test(str))			//true

	//正则区分大小写
	var re2 = new RegExp('D');
	// alert(re2.test(str))			//false

	//忽略大小写
	var re3 = new RegExp('D', 'i');
	// alert(re3.test(str))			//true

	//正则的简写
	re = new RegExp('d') 简写为：re = /\d/;
	re = new RegExp('D', 'i') 简写为：re = /\D/i;
	</script>
</head>
<body>
	
</body>
</html>